<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  
    <title>商户权限设置</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="<c:url value="/css/a.css"/>" type="text/css" rel="stylesheet"/>
<link href="<c:url value="/css/index.css"/>" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="<c:url value="/js/jquery-1.3.2.js" />"></script>   
	<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
	<script language="javascript" type="text/javascript" src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
  
  <script type="text/javascript">
  
<!--
function goback(){
  	history.go(-1);
  }
function selectAllEvent(objCheckbox){
	 	var tempObj=$(objCheckbox);
	 	if(tempObj.attr('checked')){
	 		var tableId=tempObj.attr('name');
	    	$('#'+tableId).find(":checkbox[name=userModuleRightCodeList]").each(function(){
	   		 	$(this).attr('checked',true);
	 	 	}); 
	 	}
	}

$(document).ready(function(){
    $("#backBtn").click(function(){
       $("#athourityForm").attr("action","/PWMS/athourity/searchMerchant.action");
    });
    
    $("#setBtn").click(function(){
       
    });
    
	$(":input[name=athorityValue]").each(function(){
	 	var aVal=$(this).val();
	 	$(":checkbox[name=userModuleRightCodeList]").each(function(){
	 		var moduleval=$(this).val();
	 		if(aVal==moduleval){
	 			$(this).attr('checked',true);
	 		}
	 	});
	 	
	 });
	$(":checkbox[name=userModuleRightCodeList]").each(function(){
		  var tableId=$(this).closest("table").attr('id');
		  var checkedNumber=$('#'+tableId).find(":checkbox[name=userModuleRightCodeList]:checked").length;
		  var totalNumber=$('#'+tableId).find(":checkbox[name=userModuleRightCodeList]").length;
		  var checkAllObj=$('#'+tableId).closest("tr").prev().find(":checkbox[name="+tableId+"]");
		  if(checkedNumber==totalNumber){
			  checkAllObj.attr('checked',true);
		  }else{
			  checkAllObj.attr('checked',false);
		  }
		  $(this).click(function(){
			  checkedNumber=$('#'+tableId).find(":checkbox[name=userModuleRightCodeList]:checked").length;
			    if(checkedNumber==totalNumber){
			    	checkAllObj.attr('checked',true);
			    }else{
			    	checkAllObj.attr('checked',false);
			    }
		  });
		 var tdObj=$(this).closest('td');
		 tdObj.find('label').click(function(){		
			 tdObj.find(":checkbox[name=userModuleRightCodeList]").each(function(){
					if($(this).attr('checked')){
						$(this).attr('checked',false);
					}else{
						$(this).attr('checked',true);
					}
					checkedNumber=$('#'+tableId).find(":checkbox[name=userModuleRightCodeList]:checked").length;
					if(checkedNumber==totalNumber){
						  checkAllObj.attr('checked',true);
					 }else{
						 checkAllObj.attr('checked',false);
					 }
			 });
		 });
	 });
	 
	 
	 
 
});
-->
</script>
  </head>
  
  <body>
    
   
  
   	<s:form id="athourityForm" action="/athourity/setAthourity.action" method="post"  theme="simple">
     <s:hidden name="merchant.id"></s:hidden>
	<div class="user_title">
	    		 <h2 class="headline-inquires">EPOS运营管理系统<br /><span class="sub-title">Resource sharing card management system
	    		 </span></h2>
	    		</div>
	
	<table width="100%"  border="1" cellspacing="0" class="table">
	<tr><td colspan="4" align="center">
	<h2 class="headline-inquires">商户及权限信息<br /><span class="sub-title"></span></h2>
	    		
	</td></tr>
	<tr><td align="right">商户号：</td><td> <s:property value="#request.merchantInfo.merchantNo" /> </td>
	<td align="right">商户名：</td><td> <s:property value="#request.merchantInfo.merchantName" /> 
	</td></tr>
	<tr><td align="right">商户类型：</td><td>
	 <s:property value="#request.merchantInfo.merchantType" /> 

	</td>
	<td align="right">商户状态：</td><td>
	 <s:property value="#request.merchantInfo.merchantStatu" /> 
	
	</td></tr>
	<tr><td align="right">所属商户：</td><td>
	 <s:property value="#request.merchantInfo.parentMerchantNo" /> 
</td>
	<td align="right">联系电话：</td><td>
	 <s:property value="#request.merchantInfo.mobilePhone" /> 
</td>	</tr>
	<tr><td align="right"> 商户费率：</td><td colspan="1">
	 <s:property value="#request.merchantInfo.feilv" /> 
	</td>
	<td align="right"> 单笔最大交易额：</td><td colspan="1">
	 <s:property value="#request.merchantInfo.payMax" /> 
	</td>
	</tr>
	
	<tr>
	<td align="right"> 单日最大交易额：</td><td colspan="3">
	 <s:property value="#request.merchantInfo.dayPayMax" /> 
	</td>
	</tr>

	</table>
	
    <div  style="overflow-y:auto;overflow-x:hidden;width:100%;height:500px; border: 1px solid #aabbcc;background-color:#f2f2f2;">
 
   <s:iterator value="#request.rightList" status="stat" id="element">
    <s:iterator value="#element.modules" status="stat" id="bean">
    	<s:hidden name="athorityValue" value="%{#bean.moduleCode}"></s:hidden>
    </s:iterator>
   </s:iterator>
   
   <table id="userRight" class="standerWidth" border="0" cellpadding="0" cellspacing="1">
	
	<tbody>
		<s:iterator value="#request.menuList" status="stat" id="element">
		<tr>
			<td  colspan="1" align="left"><s:property value="#element.moduleCategoryName"/>&nbsp;
	   		 <s:checkboxlist list="#{#element.moduleCategoryCode:''}" name="%{#element.moduleCategoryCode}"   cssClass="checkbox" onclick="selectAllEvent(this)"/>&nbsp;
			</td>
		</tr>
		<tr><td >
			<table id="${element.moduleCategoryCode}" class="standerWidth" border="0" cellpadding="0" cellspacing="1">
				<tbody><tr><td width="20" >&nbsp;</td>
					<s:iterator value="#element.modules" status="st" id="module">
							
									
											<td width="140" class="label">
												<s:checkboxlist name="userModuleRightCodeList" list="#{#module.moduleCode:''}" cssClass="checkbox"></s:checkboxlist>
												<label><s:property value="#module.moduleName"/></label>
											</td>
										
									
					</s:iterator>
					<td>&nbsp;</td>
								</tr>
				</tbody>
			</table>
		</td></tr>
	
	</s:iterator>
		<tr>
			<td  colspan="1" align="center">
			<s:submit  id="setBtn" value="保  存" ></s:submit>
			&nbsp;&nbsp;
			
				<s:submit id="backBtn" value="返  回" ></s:submit>
			
			</td>
		</tr>
	</tbody>
	
</table>

   
    </div>
    </s:form>
    
  </body>
</html>
